<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/views1/DTD/views1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<style>
		.div-dialog-label{ width: 90px; float:left;}
	</style>
	<ui:composition template="/views/layout/main.xhtml">
		<ui:define name="conteudo">
			<h:form id="formPrincipal">
				<div id="divBtn" class="grid_18 div_48">
					<h:panelGroup id="pnlBtn">
						<c:if test="#{permissaoBean.perfilInstance.id != null}">
							<p:commandButton ajax="false" action="#{permissaoBean.editar}" styleClass="edit-notes" title="Editar"/>
						</c:if>
						<p:commandButton ajax="true" actionListener="#{permissaoBean.preBuscaPerfil}" update="formBuscaPerfil" title="Buscar" styleClass="search-address" oncomplete="dlgBuscaPerfil.show();"/>
						<p:commandButton widgetVar="btn_Home" styleClass="home" ajax="false" action="#{permissaoBean.goHome}" title="Home" />
					</h:panelGroup>
				</div>

				<div class="grid_18 titulo">
					Permissões
				</div>
				
				<div class="grid_18">
					<p:messages id="message"/>
				</div>
				
				
				<div class="grid_2">
					Perfil
				</div>
				
				<div class="grid_8">
					<p:inputText styleClass="width_7" disabled="true" value="#{permissaoBean.perfilInstance.nome}"/>
				</div>
				
				<div class="grid_2">
					Situação
				</div>
				
				<div class="grid_6">
					<p:inputText styleClass="width_6" disabled="true" value="#{permissaoBean.perfilInstance.situacao}"/>
				</div>
				
				<div class="grid_18">
					<p:spacer height="15px"/>
				</div>
				
				<div class="grid_18">
					<p:dataTable widgetVar="dataTablePermissao" 
								id="dataTablePermissao" 
								paginator="true"
								lazy="true"
								dynamic="true"
								var="perm"
								value="#{permissaoBean.permissaoList}" 
								emptyMessage="Nenhum registro encontrado!" 
								rows="10">
						<p:column headerText="Nome" sortBy="#{perm.id}">
				            <h:outputText value="#{perm.pagina.nome}" />  
				        </p:column>
				        <p:column headerText="URL" sortBy="#{perm.id}">
				            <h:outputText value="#{perm.pagina.url}" />  
				        </p:column> 
					</p:dataTable>
					<br/>	
				</div>
			</h:form>
			
			<!-- INCLUSAO DE OUTROS XHTMLs -->
			<ui:include src="/views/permissao/_promptBuscaPerfil.xhtml"/>
		</ui:define>
	</ui:composition>
</f:view>